package main.gui;

import java.awt.BorderLayout;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

/*
 * 
 */
public class CoreMessageFrame extends JFrame {

	private static final long serialVersionUID = 1241423393121571203L;

	private static final String MESSAGE_BREAK = "\n*************************\n";

	private JTextArea messageTextArea;

	/**
	 * Creates a new message frame.
	 */
	public CoreMessageFrame() {
		super("Core Messages");

		// Set frame properties
		this.setSize(400, 800);
		this.setLocation(200, 100);
		this.setResizable(true);
		this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

		// Setup layout
		this.setLayout(new BorderLayout());
		messageTextArea = new JTextArea("");
		JScrollPane scrollPane = new JScrollPane(messageTextArea);
		this.add(scrollPane, BorderLayout.CENTER);
	}

	/**
	 * Append the new message to the end of the message area.
	 * 
	 * @param message
	 *            The message string including the class name.
	 */
	public void addMessage(String message) {
		messageTextArea.setText(messageTextArea.getText()
				+ MESSAGE_BREAK
				+ message);
	}

}
